Decimal encoding of numbers is used in a variety of systems and applications, such as databases, financial, and industrial computing. Database systems are no longer confined to simple querying and are increasingly requested to perform complex data analysis, involving complex numeric operations. Thus, there is an increasing need to support arithmetic operations with high-performance. Database systems have been extended with support for binary floating point primitive types allowing floating point operations (e.g., float and double, following the IEEE 754 standard), thereby avoiding costly conversion of decimal representations into binary representations when applications know in advance that floating operations are sufficient. However, it may still be necessary to support fast arithmetic operations when the loss of precision or the lack of reproducible results from using floating point operations are unacceptable. Arithmetic operations on decimal encoded numbers are often complex and usually unsupported by hardware, and are therefore often implemented in a software library, which is typically slower than using native hardware instructions. For example, Decimal Floating Point arithmetic (DFP) for 32-, 64-, and 128-bit representations has been standardized in IEEE 754-2008, but is rarely supported (and Decimal Fixed Point arithmetic is not supported at all). Some database systems allow re-encoding ahead of time of variable-length decimal representations into binary representations. However, just-in-time conversion to an optimized decimal format best suited for a particular arithmetic expression (e.g., used in a query) remains an unsolved problem.